import { ChainId } from '@uniswap/sdk';
import { Configuration } from './basis-cash/config';
import { BankInfo,BlackholeInfo } from './basis-cash';
import { formatUnits } from 'ethers/lib/utils';
import { BigNumber } from 'ethers';

const configurations: { [env: string]: Configuration } = {
  development: {
    // chainId: 256,
    // etherscanUrl: 'https://scan-testnet.hecochain.com',
    // defaultProvider: 'https://http-testnet.hecochain.com',
    // deployments: require('./basis-cash/deployments/deployments.mainnet.json'),
    chainId: 128,
    etherscanUrl: 'https://scan.hecochain.com',
    defaultProvider: 'https://http-mainnet.hecochain.com',
    deployments: require('./basis-cash/deployments/deployments.hecotest.json'),
    externalTokens: {
      USDT:  ['0xa71edc38d189767582c38a3145b5873052c3e47a', 18], 
      HUSD:  ['0x0298c2b32eae4da002a15f36fdf7615bea3da047', 8], 
      HBTC:  ['0x66a79d23e58475d2738179ca52cd0b41d73f0bea', 18], 
      wETH:  ['0x64ff637fb478863b7468bc97d30a5bf3a428a1fd', 18], 
      wHT:   ['0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f', 18], 
      pNEO:  ['0x6514a5ebff7944099591ae3e8a5c0979c83b2571', 8], 
      HFIL:  ['0xae3a768f9ab104c69a7cd6041fe16ffa235d1810', 18], 
      HDOT:  ['0xa2c49cee16a5e5bdefde931107dc1fae9f7773e3', 18],
      HLTC:  ['0xecb56cf772b5c9a6907fb7d32387da2fcbfb63b4', 18],
      BAG:   ['0xa042fb0e60125a4022670014ac121931e7501af4', 18],
      fHUSD: ['0xB16Df14C53C4bcfF220F4314ebCe70183dD804c0', 18], 
      fUSDT: ['0xAab0C9561D5703e84867670Ac78f6b5b4b40A7c1', 18], 
      fHBTC: ['0xF2a308d3Aea9bD16799A5984E20FDBfEf6c3F595', 18], 
      fETH:  ['0x033F8C30bb17B47f6f1f46F3A42Cc9771CCbCAAE', 18], 
      fHT:   ['0x824151251B38056d54A15E56B73c54ba44811aF8', 18], 
      fNEO:  ['0x92701DA6A28Ca70aA5Dfca2B8Ae2b4B8a22a0C11', 18], 
      fHFIL: ['0x043aFB65e93500CE5BCbf5Bbb41FC1fDcE2B7518', 18],
      fHDOT: ['0xCca471B0d49c0d4835a5172Fd97ddDEA5C979100', 18],
      fHLTC: ['0x4937A83Dc1Fa982e435aeB0dB33C90937d54E424', 18],
      Filda: ['0xe36ffd17b2661eb57144ceaef942d95295e637f0', 18],
       
      SHARE:  ['0x41198c6736d23734E6d17a6F0B4f2D15d2621A3a',  18],
      sCASH:  ['0xb6ccFA7Ef3a295932536E0988CffD85228cB177c',  18],

      sCASH_HUSD_LP:  ['0x4f87fC0482Ca3032F7f853fD284F3D1f29a86074', 18],
      SHARE_HUSD_LP:  ['0xf9916A3b60a893271159b288d8db463891be95e5', 18],
      sCASH_USDT_LP:  ['0x16DA58375f835eCB4b627a5aA2E948f46CD45F34', 18],
      SHARE_USDT_LP:  ['0x534b76013F41d973f27B5bd3b33EcEA56697473a', 18],
      sCASH_SHARE_LP: ['0xc4f27CD79C4c26a1e5f5e60A77690B7c7C249E23', 18],

      Fund: ['0xAB1B709667ef9869d6287542aaF720D32330E07a',  18],
      TPT: ['0x9ef1918a9bee17054b35108bd3e2665e2af1bb1b', 4],
    },
    baseLaunchDate: new Date('2021-02-19T00:00:00Z'),
    bondLaunchesAt: new Date('2021-02-24T00:00:00Z'),
    boardroomLaunchesAt: new Date('2021-02-28T00:00:00Z'),
    refreshInterval: 30000,
    gasLimitMultiplier: 1.7,
  },
  production: {
    chainId: 128,
    etherscanUrl: 'https://scan.hecochain.com',
    defaultProvider: 'https://http-mainnet-node.huobichain.com',
    deployments: require('./basis-cash/deployments/deployments.hecotest.json'),
    externalTokens: {
      USDT:  ['0xa71edc38d189767582c38a3145b5873052c3e47a', 18], 
      HUSD:  ['0x0298c2b32eae4da002a15f36fdf7615bea3da047', 8], 
      HBTC:  ['0x66a79d23e58475d2738179ca52cd0b41d73f0bea', 18], 
      wETH:  ['0x64ff637fb478863b7468bc97d30a5bf3a428a1fd', 18], 
      wHT:   ['0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f', 18], 
      pNEO:  ['0x6514a5ebff7944099591ae3e8a5c0979c83b2571', 8], 
      HFIL:  ['0xae3a768f9ab104c69a7cd6041fe16ffa235d1810', 18], 
      HDOT:  ['0xa2c49cee16a5e5bdefde931107dc1fae9f7773e3', 18],
      HLTC:  ['0xecb56cf772b5c9a6907fb7d32387da2fcbfb63b4', 18],
      BAG:   ['0xa042fb0e60125a4022670014ac121931e7501af4', 18],
      fHUSD: ['0xB16Df14C53C4bcfF220F4314ebCe70183dD804c0', 18], 
      fUSDT: ['0xAab0C9561D5703e84867670Ac78f6b5b4b40A7c1', 18], 
      fHBTC: ['0xF2a308d3Aea9bD16799A5984E20FDBfEf6c3F595', 18], 
      fETH:  ['0x033F8C30bb17B47f6f1f46F3A42Cc9771CCbCAAE', 18], 
      fHT:   ['0x824151251B38056d54A15E56B73c54ba44811aF8', 18], 
      fNEO:  ['0x92701DA6A28Ca70aA5Dfca2B8Ae2b4B8a22a0C11', 18], 
      fHFIL: ['0x043aFB65e93500CE5BCbf5Bbb41FC1fDcE2B7518', 18],
      fHDOT: ['0xCca471B0d49c0d4835a5172Fd97ddDEA5C979100', 18],
      fHLTC: ['0x4937A83Dc1Fa982e435aeB0dB33C90937d54E424', 18],
      Filda: ['0xe36ffd17b2661eb57144ceaef942d95295e637f0', 18],
       
      SHARE:  ['0x41198c6736d23734E6d17a6F0B4f2D15d2621A3a',  18],
      sCASH:  ['0xb6ccFA7Ef3a295932536E0988CffD85228cB177c',  18],

      sCASH_HUSD_LP:  ['0x29471983b759Ccb802f486244B26A7c7dce8b7B5', 18],
      SHARE_HUSD_LP:  ['0xb1188f0bb3eb9a49C0bfcFA87238773352C151C4', 18],
      sCASH_USDT_LP:  ['0x454058df2d7ffB8A845Bf884a30D0391166144E7', 18],
      SHARE_USDT_LP:  ['0xF61e00443FF42371b9efC4434a610F6e7C0C84aA', 18],
      sCASH_SHARE_LP: ['0xfD8E7B365575E7abAA9Cf8F4C205bd8534346878', 18],

      Fund: ['0xAB1B709667ef9869d6287542aaF720D32330E07a',  18],
      TPT: ['0x9ef1918a9bee17054b35108bd3e2665e2af1bb1b', 4],
    },
    baseLaunchDate: new Date('2021-02-19T00:00:00Z'),
    bondLaunchesAt: new Date('2021-02-24T00:00:00Z'),
    boardroomLaunchesAt: new Date('2021-03-01T00:00:00Z'),
    refreshInterval: 30000,
    gasLimitMultiplier: 1.7,
  },
  // production: {
  //   chainId: 128,
  //   etherscanUrl: 'https://scan.hecochain.com',
  //   defaultProvider: 'https://http-mainnet-node.huobichain.com',
  //   deployments: require('./basis-cash/deployments/deployments.mainnet.json'),
  // },
};

export const bankDefinitions: { [contractName: string]: BankInfo } = {
  sCASH_USDT_lp_pool: {
    name: 'Earn SHARE by sCASH_USDT_LP',
    contract: 'sCASH_USDT_lp_pool',
    depositTokenName: 'sCASH_USDT_LP',
    earnTokenName: 'SHARE',
    finished: false,
    sort: 1,
  },
  sCASH_HUSD_lp_pool: {
    name: 'Earn SHARE by sCASH_HUSD_LP',
    contract: 'sCASH_HUSD_lp_pool',
    depositTokenName: 'sCASH_HUSD_LP',
    earnTokenName: 'SHARE',
    finished: false,
    sort: 2,
  },
  SHARE_USDT_lp_pool: {
    name: 'Earn SHARE by SHARE_USDT_LP',
    contract: 'SHARE_USDT_lp_pool',
    depositTokenName: 'SHARE_USDT_LP',
    earnTokenName: 'SHARE',
    finished: false,
    sort: 3,
  },
  SHARE_HUSD_lp_pool: {
    name: 'Earn SHARE by SHARE_HUSD_LP',
    contract: 'SHARE_HUSD_lp_pool',
    depositTokenName: 'SHARE_HUSD_LP',
    earnTokenName: 'SHARE',
    finished: false,
    sort: 4,
  },

  sCASH_USDT_pool: {
    name: 'Earn sCASH by USDT',
    contract: 'sCASH_USDT_pool',
    depositTokenName: 'USDT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 5,
  },
 
  sCASH_HUSD_pool: {
    name: 'Earn sCASH by HUSD',
    contract: 'sCASH_HUSD_pool',
    depositTokenName: 'HUSD',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 6,
  },

  sCASH_wHT_pool: {
    name: 'Earn sCASH by wHT',
    contract: 'sCASH_wHT_pool',
    depositTokenName: 'wHT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 7,
  },

  sCASH_pNEO_pool: {
    name: 'Earn sCASH by pNEO',
    contract: 'sCASH_pNEO_pool',
    depositTokenName: 'pNEO',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 8,
  },

  sCASH_wETH_pool: {
    name: 'Earn sCASH by wETH',
    contract: 'sCASH_wETH_pool',
    depositTokenName: 'wETH',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 9,
  },


  sCASH_HBTC_pool: {
    name: 'Earn sCASH by HBTC',
    contract: 'sCASH_HBTC_pool',
    depositTokenName: 'HBTC',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 10,
  },

  sCASH_HDOT_pool: {
    name: 'Earn sCASH by HDOT',
    contract: 'sCASH_HDOT_pool',
    depositTokenName: 'HDOT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 11,
  },

  sCASH_HFIL_pool: {
    name: 'Earn sCASH by HFIL',
    contract: 'sCASH_HFIL_pool',
    depositTokenName: 'HFIL',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 12,
  },

  sCASH_HLTC_pool: {
    name: 'Earn sCASH by HLTC',
    contract: 'sCASH_HLTC_pool',
    depositTokenName: 'HLTC',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 13,
  },

  sCASH_BAG_pool: {
    name: 'Earn sCASH by BAG',
    contract: 'sCASH_BAG_pool',
    depositTokenName: 'BAG',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 14,
  },

  sCASH_TPT_pool: {
    name: 'Earn sCASH by TPT',
    contract: 'sCASH_TPT_pool',
    depositTokenName: 'TPT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 14,
  },



//ftoken stake
  sCASH_fUSDT_pool: {
    name: 'Earn sCASH by fUSDT',
    contract: 'sCASH_fUSDT_pool',
    depositTokenName: 'fUSDT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 15,
  },
  sCASH_fHUSD_pool: {
    name: 'Earn sCASH by fHUSD',
    contract: 'sCASH_fHUSD_pool',
    depositTokenName: 'fHUSD',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 16,
  },
  sCASH_fHT_pool: {
    name: 'Earn sCASH by fHT',
    contract: 'sCASH_fHT_pool',
    depositTokenName: 'fHT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 17,
  },
  sCASH_fNEO_pool: {
    name: 'Earn sCASH by fpNEO',
    contract: 'sCASH_fNEO_pool',
    depositTokenName: 'fNEO',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 18,
  },
  sCASH_fETH_pool: {
    name: 'Earn sCASH by fETH',
    contract: 'sCASH_fETH_pool',
    depositTokenName: 'fETH',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 19,
  },
  sCASH_fHBTC_pool: {
    name: 'Earn sCASH by fHBTC',
    contract: 'sCASH_fHBTC_pool',
    depositTokenName: 'fHBTC',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 20,
  },
  sCASH_fHDOT_pool: {
    name: 'Earn sCASH by fHDOT',
    contract: 'sCASH_fHDOT_pool',
    depositTokenName: 'fHDOT',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 21,
  },
  sCASH_fHFIL_pool: {
    name: 'Earn sCASH by fHFIL',
    contract: 'sCASH_fHFIL_pool',
    depositTokenName: 'fHFIL',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 22,
  },
  sCASH_fHLTC_pool: {
    name: 'Earn sCASH by fHLTC',
    contract: 'sCASH_fHLTC_pool',
    depositTokenName: 'fHLTC',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 23,
  },
  sCASH_Filda_pool: {
    name: 'Earn sCASH by Filda',
    contract: 'sCASH_Filda_pool',
    depositTokenName: 'Filda',
    earnTokenName: 'sCASH',
    finished: false,
    sort: 24,
  },

  
};



export const blackholeDefinitions: { [contractName: string]: BlackholeInfo } = {
    // sCASH_spool_N
    sCASH_spool_0: {
      name: 'sFUND Launch Phase 1',
      contract: 'sCASH_spool_0',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 4,
    },
    sCASH_spool_1: {
      name: 'sFUND Launch Phase 2',
      contract: 'sCASH_spool_1',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 5,
    },
    sCASH_spool_2: {
      name: 'sFUND Launch Phase 3',
      contract: 'sCASH_spool_2',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 6,
    },
    sCASH_spool_3: {
      name: 'sFUND Launch Phase 4',
      contract: 'sCASH_spool_3',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 7,
    },
    sCASH_spool_4: {
      name: 'sFUND Launch Phase 5',
      contract: 'sCASH_spool_4',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 8,
    },

    sCASH_CashPool: {
      name: 'sFUND CashSwap',
      contract: 'sCASH_CashPool',
      depositTokenName: 'USDT',
      earnTokenName: 'sCASH',
      finished: false,
      sort: 9,
    },
    sCASH_PegPool: {
      name: 'sFUND PegSwap',
      contract: 'sCASH_PegPool',
      depositTokenName: 'sCASH',
      earnTokenName: 'USDT',
      finished: false,
      sort: 10,
    },
    sCASH_SharePool: {
      name: 'sFUND ShareSwap',
      contract: 'sCASH_SharePool',
      depositTokenName: 'sCASH',
      earnTokenName: 'SHARE',
      finished: false,
      sort: 11,
    },
};

export default configurations[process.env.NODE_ENV || "development"];
